package LC;

import java.util.Arrays;
import java.util.List;

/**
 * @ClassName LC539
 * @Description: TODO
 * @Author hl
 * @Date 2020/9/14
 * @Version V1.0
 **/
public class LC539 {
    public int findMinDifference(List<String> timePoints) {
        int size=timePoints.size();
        int []arr=new int[size];
        int i=0;
        for(String key:timePoints){
            int t1=Integer.valueOf(key.substring(0,2));
            int t2=Integer.valueOf(key.substring(3,5));
            arr[i++]=t1*60+t2;
        }
        Arrays.sort(arr);
        int res=60*24+arr[0]-arr[size-1];
        for(int j=0;j<size-1;j++){
            int dis=arr[j+1]-arr[j];
            if(dis<res){
                res=dis;
            }
        }
        return  res;
    }
}
